home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
oper_sys
/
amber
/
amber.lha
/
MoveThread.s
< prev
next >
Wrap
Text File
|
1991-04-25
|
13KB
|
655 lines
.verstamp 2 10
.data
.align 2
.align 0
$$7:
.word 1634027556 : 1
.word 980575588 : 1
.word 1635135264 : 1
.word 794898290 : 1
.word 1869181551 : 1
.word 1966040428 : 1
.word 1752444721 : 1
.word 1634429797 : 1
.word 1630496884 : 1
.word 1919246957 : 1
.word 1396920879 : 1
.word 1987005743 : 1
.word 1919439973 : 1
.word 778330469 : 1
.word 544615523 : 1
.word 540094001 : 1
.word 808398905 : 1
.word 842149688 : 1
.word 976630048 : 1
.word 876229685 : 1
.word 1752440885 : 1
.word 1634429797 : 1
.word 1159751796 : 1
.word 1277194360 : 1
.word 1701536623 : 1
.word 1948269170 : 1
.word 1802200424 : 1
.word 543716449 : 1
.word 36 : 1
.extern _iob 60
.data
.align 2
.align 0
$$272:
.word _Object_Size
.word _Object_ChangeDescriptor
.word _NamedObject_Error
.word _NamedObject_Panic
.word _Thread_Print
.word _Thread__dtor
.word _Thread_Start
.word _Thread_WillJoin
.word _Thread_WillNotJoin
.word _Thread_Join
.word _Thread_Terminate
.word _Thread_Sleep
.word _Thread_Wakeup
.word _Thread_Run
.word _Thread_FailedRPC
.word 0 : 1
.extern systhread 4
.extern errno 4
.extern sys_errlist 0
.data
.align 2
.align 0
$$309:
.word _Object_Size
.word _Object_ChangeDescriptor
.word _NamedObject_Error
.word _NamedObject_Panic
.word _Process_Print
.word _Process_SchedThreadBody
.word _Process_SchedLoop
.word _Process__dtor
.word _Process_NewProcess
.word _Process_Start
.word _Process_Die
.word 0 : 1
.extern sys_nerr 4
.extern _bufendtab 0
.data
.align 2
.align 0
$$57:
.word _streambuf_overflow
.word _streambuf_underflow
.word 0 : 1
.data
.align 2
.align 0
$$62:
.word _filebuf_overflow
.word _filebuf_underflow
.word 0 : 1
.data
.align 2
.align 0
$$320:
.word _Object_Size
.word _Object_ChangeDescriptor
.word _NamedObject_Error
.word _NamedObject_Panic
.word _NamedObject_Print
.word _ThreadPool__dtor
.word _ThreadPool_get
.word _ThreadPool_insert
.word _ThreadPool_size
.word 0 : 1
.data
.align 2
.align 0
$$66:
.word _circbuf_overflow
.word _circbuf_underflow
.word 0 : 1
.data
.align 2
.align 0
$$326:
.word _Object_Size
.word _Object_ChangeDescriptor
.word _NamedObject_Error
.word _NamedObject_Panic
.word _NamedObject_Print
.word _ThreadPoolQueue__dtor
.word _ThreadPoolQueue_get
.word _ThreadPoolQueue_insert
.word _ThreadPoolQueue_size
.word 0 : 1
.data
.align 2
.align 0
$$336:
.word _Object_Size
.word _Object_ChangeDescriptor
.word _NamedObject_Error
.word _NamedObject_Panic
.word _Scheduler_Print
.word _Scheduler__dtor
.word _Scheduler_GetReadyThread
.word _Scheduler_Enqueue
.word _Scheduler_Tick
.word _Scheduler_Arm
.word _Scheduler_SetReadyPool
.word 0 : 1
.extern sched 4
.extern cin 12
.extern cout 8
.data
.align 2
.align 0
$$353:
.ascii "MakeInActive has an idle thread\X00"
.extern cerr 8
.extern WS 1
.data
.align 2
.align 0
$$355:
.ascii "movebaseframe botched\X00"
.data
.align 2
.align 0
$$168:
.word _Object_Size
.word _Object_ChangeDescriptor
.word 0 : 1
.data
.align 2
.align 0
$$190:
.word _Object_Size
.word _Object_ChangeDescriptor
.word _NamedObject_Error
.word _NamedObject_Panic
.word _NamedObject_Print
.word 0 : 1
.data
.align 2
.align 0
$$194:
.word _Object_Size
.word _Object_ChangeDescriptor
.word _NamedObject_Error
.word _NamedObject_Panic
.word _NamedObject_Print
.word 0 : 1
.extern thisnode 4
.extern AmberState 4
.data
.align 2
.align 0
$$217:
.word _Object_Size
.word _Object_ChangeDescriptor
.word 0 : 1
.extern stacksize 4
.extern spmask 4
.data
.align 2
.align 0
$$227:
.word $$226
.word _Object_ChangeDescriptor
.word 0 : 1
.data
.align 2
.align 0
$$232:
.word _Object_Size
.word _Object_ChangeDescriptor
.word 0 : 1
.data
.align 2
.align 0
$$237:
.word _Object_Size
.word _Object_ChangeDescriptor
.word _NamedObject_Error
.word _NamedObject_Panic
.word _NamedObject_Print
.word 0 : 1
.data
.align 2
.align 0
$$240:
.word _Object_Size
.word _Object_ChangeDescriptor
.word _NamedObject_Error
.word _NamedObject_Panic
.word _ObjectList_Print
.word 0 : 1
.data
.align 2
.align 0
$$254:
.word _Object_Size
.word _Object_ChangeDescriptor
.word _WiredThreadState_Print
.word 0 : 1
.text
.align 2
.file 2 "MoveThread.c"
.globl ThreadArrived
.loc 2 14
# 14 {
.ent ThreadArrived 2
ThreadArrived:
.option O2
subu $sp, 32
sw $31, 28($sp)
sw $16, 24($sp)
.mask 0x80010000, -4
.frame $sp, 32, $31
sw $4, 32($sp)
.loc 2 17
# 15 Thread* movedThread;
# 16
# 17 movedThread = (Thread*)((unsigned)threadBody - 4);
.loc 2 20
# 18 // pout("thread 0x%x has arrived and is %s",
# 19 // movedThread, movedThread->IsActive()? "Active" : "Inactive");
# 20 LockDescriptors();
.livereg 0xff0e,0xfff
jal LockDescriptors
.loc 2 21
# 21 ObjectArrived(movedThread);
lw $16, 32($sp)
addu $16, $16, -4
move $4, $16
.livereg 0x800ff0e,0xfff
jal ObjectArrived
.loc 2 22
# 22 UnlockDescriptors();
.livereg 0xff0e,0xfff
jal UnlockDescriptors
.loc 2 24
# 23 // *thread_data((unsigned)movedThread->StackTop()) = movedThread;;
# 24 if (movedThread->IsActive()) {
lw $3, 96($16)
and $2, $3, 128
beq $2, $0, $33
.loc 2 27
# 25 // From the time this was marked inactive it
# 26 // could have been interrupted to do an RPC
# 27 movedThread->MakeInactive();
bne $2, 0, $32
move $4, $16
la $5, $$353
move $6, $0
move $7, $0
.livereg 0xf00ff0e,0xfff
lw $14, 12($16)
lw $15, 12($14)
jal $15
lw $3, 96($16)
$32:
and $2, $3, -129
sw $2, 96($16)
.loc 2 28
# 28 }
$33:
.loc 2 29
# 29 movedThread->Enreadyq();
move $4, $16
.livereg 0x800ff0e,0xfff
jal _Thread_Enreadyq
.loc 2 31
# 30
# 31 return 0;
move $2, $0
lw $16, 24($sp)
lw $31, 28($sp)
addu $sp, 32
j $31
.end ThreadArrived
.text
.align 2
.file 2 "MoveThread.c"
.globl _Object_FetchThisThread
.loc 2 43
# 43 {
.ent _Object_FetchThisThread 2
_Object_FetchThisThread:
.option O2
subu $sp, 72
sw $31, 44($sp)
sw $20, 40($sp)
sd $18, 32($sp)
sd $16, 24($sp)
.mask 0x801F0000, -28
.frame $sp, 72, $31
move $19, $4
sw $5, 76($sp)
.loc 2 48
# 44 struct MoveThreadArgs args;
# 45 Thread *me;
# 46
# 47
# 48 me = thisthread;
.livereg 0xff0e,0xfff
jal mythread_data
lw $16, 0($2)
.loc 2 49
# 49 me->NonPreemptable();
lw $14, 116($16)
addu $15, $14, 1
sw $15, 116($16)
.loc 2 50
# 50 me->DisableChecks();
lw $24, 112($16)
addu $25, $24, 1
sw $25, 112($16)
.loc 2 52
# 51
# 52 moveBaseFrame = me->GetMoveBaseFrame();
move $4, $16
.livereg 0x800ff0e,0xfff
jal _Thread_GetMoveBaseFrame
sw $2, 76($sp)
.loc 2 61
# 61 LockDescriptors();
.livereg 0xff0e,0xfff
jal LockDescriptors
.loc 2 62
# 62 this->AwaitTransfer();
move $4, $19
.livereg 0x800ff0e,0xfff
jal _Object_AwaitTransfer
.loc 2 63
# 63 me->CheckAnchor();
move $4, $16
.livereg 0x800ff0e,0xfff
jal _Thread_CheckAnchor
li $17, -2147483648
li $20, 1073741824
.loc 2 64
# 64 me->ChangeDescriptor(DFLocal, DFMoving);
move $4, $16
move $5, $17
move $6, $20
.livereg 0xe00ff0e,0xfff
lw $8, 12($16)
lw $9, 4($8)
jal $9
.loc 2 65
# 65 UnlockDescriptors();
.livereg 0xff0e,0xfff
jal UnlockDescriptors
.loc 2 69
# 66
# 67 // Move thread and frames to target node.
# 68 //
# 69 args.thread = me;
sw $16, 56($sp)
.loc 2 70
# 70 args.moveBaseFrame = (char *)moveBaseFrame;
lw $10, 76($sp)
sw $10, 60($sp)
.loc 2 71
# 71 args.targetObject = this;
sw $19, 64($sp)
.loc 2 72
# 72 args.arrivalFunc = ThreadArrived;
la $11, ThreadArrived
sw $11, 68($sp)
addu $18, $sp, 56
$34:
.loc 2 75
# 73
# 74 for (;;) {
# 75 while (!this->IsLocal()) {
lw $12, 0($19)
and $13, $12, $17
bne $13, $0, $36
$35:
.loc 2 76
# 76 me->SetMoveArgs((char *)&args);
sw $18, 128($16)
.loc 2 78
# 77 // pout("calling for remote switch at 0x%x",me);
# 78 me->Switch();
move $4, $16
.livereg 0x800ff0e,0xfff
jal _Thread_Switch
.loc 2 79
# 79 }
.loc 2 79
lw $14, 0($19)
and $15, $14, $17
beq $15, $0, $35
$36:
.loc 2 82
# 80 // Now that we are copying the entire stack we don't need this
# 81 // thisthread = me;
# 82 LockDescriptors();
.livereg 0xff0e,0xfff
jal LockDescriptors
.loc 2 83
# 83 if (this->IsLocal())
lw $24, 0($19)
and $25, $24, $17
bne $25, $0, $37
.loc 2 84
# 84 break; // with lock held
.loc 2 89
# 85 else {
# 86 //
# 87 // Oops, it moved again. Keep chasing it.
# 88 //
# 89 this->AwaitTransfer();
move $4, $19
.livereg 0x800ff0e,0xfff
jal _Object_AwaitTransfer
.loc 2 90
# 90 me->CheckAnchor();
move $4, $16
.livereg 0x800ff0e,0xfff
jal _Thread_CheckAnchor
.loc 2 91
# 91 me->ChangeDescriptor(DFLocal, DFMoving);
move $4, $16
move $5, $17
move $6, $20
.livereg 0xe00ff0e,0xfff
lw $8, 12($16)
lw $9, 4($8)
jal $9
.loc 2 92
# 92 UnlockDescriptors();
.livereg 0xff0e,0xfff
jal UnlockDescriptors
.loc 2 93
# 93 }
.loc 2 94
# 94 }
b $34
$37:
.loc 2 101
# 101 if (moveBaseFrame != me->StackBaseFrame()) {
lw $10, 76($sp)
lw $11, 132($16)
beq $10, $11, $38
.loc 2 102
# 102 Panic("movebaseframe botched");
la $4, $$355
.livereg 0x800ff0e,0xfff
jal Panic
.loc 2 103
# 103 }
$38:
.loc 2 114
# 114 me->EnableChecks();
lw $12, 112($16)
addu $13, $12, -1
sw $13, 112($16)
.loc 2 115
# 115 UnlockDescriptors();
.livereg 0xff0e,0xfff
jal UnlockDescriptors
.loc 2 116
# 116 me->Preemptable();
lw $14, 116($16)
addu $15, $14, -1
sw $15, 116($16)
.loc 2 117
# 117 }
ld $16, 24($sp)
ld $18, 32($sp)
lw $20, 40($sp)
lw $31, 44($sp)
addu $sp, 72
j $31
.end _Object_FetchThisThread
.text
.align 2
.file 2 "MoveThread.c"
.globl DoThreadMove
.loc 2 136
# 136 {
.ent DoThreadMove 2
DoThreadMove:
.option O2
subu $sp, 120
sw $31, 36($sp)
sw $16, 32($sp)
.mask 0x80010000, -84
.frame $sp, 120, $31
move $8, $4
.loc 2 141
# 137 ThreadRPCDescription threadDesc;
# 138 char* stackTop;
# 139 int destNode;
# 140 int invokeCount;
# 141 Thread *thread = args->thread;
lw $16, 0($8)
.loc 2 143
# 142
# 143 invokeCount = thread->CountMove();
lw $2, 8($16)
addu $2, $2, 1
sw $2, 8($16)
sw $2, 60($sp)
.loc 2 152
# 152 sizeof(Thread) - (sizeof(WiredThreadState) + 4); // XXX
li $14, 208
sw $14, 76($sp)
.loc 2 153
# 153 threadDesc.threadPart.datum = (char*)((unsigned)thread + 4);
addu $3, $16, 4
sw $3, 84($sp)
.loc 2 154
# 154 threadDesc.threadPart.destAddr = (char*)((unsigned)thread + 4);
sw $3, 88($sp)
.loc 2 155
# 155 threadDesc.threadPart.next = &(threadDesc.stackPart);
addu $15, $sp, 96
sw $15, 92($sp)
.loc 2 157
# 156
# 157 stackTop = thread->StackTop();
move $4, $16
sw $8, 120($sp)
.livereg 0x800ff0e,0xfff
jal _Thread_StackTop
lw $8, 120($sp)
.loc 2 160
# 158 // copy the entire stack AND the thisthread slot as well.
# 159 threadDesc.stackPart.length = args->moveBaseFrame - stackTop +
# 160 2 * sizeof(int);
lw $24, 4($8)
subu $25, $24, $2
addu $9, $25, 8
sw $9, 100($sp)
.loc 2 161
# 161 threadDesc.stackPart.datum = stackTop; // stack grows down
sw $2, 108($sp)
.loc 2 162
# 162 threadDesc.stackPart.destAddr = stackTop;
sw $2, 112($sp)
.loc 2 163
# 163 threadDesc.stackPart.next = 0;
sw $0, 116($sp)
.loc 2 169
# 164
# 165 //
# 166 // Move the thread and stack.
# 167 //
# 168 destNode = MoveData((RPCDatum*)&threadDesc, args->targetObject,
# 169 args->arrivalFunc, thread);
addu $4, $sp, 72
lw $5, 8($8)
lw $6, 12($8)
move $7, $16
.livereg 0xf00ff0e,0xfff
jal MoveData
sw $2, 64($sp)
.loc 2 171
# 170
# 171 if ((destNode != thisnode->NodeNum()) &&
lw $4, thisnode
.livereg 0x800ff0e,0xfff
jal _Node_NodeNum
lw $10, 64($sp)
beq $10, $2, $40
lw $11, 60($sp)
lw $12, 8($16)
bne $11, $12, $40
.loc 2 173
# 172 (invokeCount == thread->GetMoveCount())) {
# 173 LockDescriptors();
.livereg 0xff0e,0xfff
jal LockDescriptors
.loc 2 174
# 174 if (invokeCount == thread->GetMoveCount())
lw $13, 60($sp)
lw $14, 8($16)
bne $13, $14, $39
.loc 2 175
# 175 ObjectDeparted(thread, destNode);
move $4, $16
lw $5, 64($sp)
.livereg 0xc00ff0e,0xfff
jal ObjectDeparted
$39:
.loc 2 180
# 176 // Wait a second, can't we get a missed wakeup here if we
# 177 // don't call ObjectDeparted? It's true we don't want to
# 178 // mark the descriptor, but we probably do want to do a
# 179 // TransferComplete. XXX
# 180 UnlockDescriptors();
.livereg 0xff0e,0xfff
jal UnlockDescriptors
.loc 2 181
# 181 }
.loc 2 182
# 182 }
$40:
lw $16, 32($sp)
lw $31, 36($sp)
addu $sp, 120
j $31
.end DoThreadMove
.text
.align 2
.file 2 "MoveThread.c"
.loc 2 185
# 183
# 184
# 185
.ent $$226 2
$$226:
.option O2
.frame $sp, 0, $31
.loc 2 185
lw $2, 20($4)
j $31
.end _Stack_Size